package com.example.film.controller;

import com.example.film.entity.Top100ChinaSell;
import com.example.film.service.Top100ChinaSellService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "top100中国电影票房信息管理接口")
@CrossOrigin
@RestController
@RequestMapping("top100/v1")
public class Top100ChinaSellController {
    @Autowired
    private Top100ChinaSellService top100ChinaSellService;

    @ApiOperation("top100中国电影票房信息")
    @GetMapping("/films")
    public List<Top100ChinaSell> getTop100ChinaSell(){
        return top100ChinaSellService.findTop100ChinaSell();
    }

    @ApiOperation("分页查询top100中国电影票房信息")
    @GetMapping("/film")
    public List<Top100ChinaSell> getTop100ChinaSellInfo(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
        return top100ChinaSellService.findTop100ChinaSellInfo(pageNum, pageSize);
    }

    @ApiOperation("历年冠军影片票房信息")
    @GetMapping("/max")
    public List<Top100ChinaSell> getFilmEachMaxSell(){
        return top100ChinaSellService.findFilmEachMaxSell();
    }
}
